/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.tarifador.dataModel;

import br.com.tarifador.model.Agenda;
import java.util.List;
import javax.faces.model.ListDataModel;
import org.primefaces.model.SelectableDataModel;

/**
 *
 * @author charles
 */
public class AgendaDataModel extends ListDataModel<Agenda> implements SelectableDataModel<Agenda> {

    public AgendaDataModel() {
    }

    public AgendaDataModel(List<Agenda> list) {
        super(list);
    }

    @Override
    public Object getRowKey(Agenda rowKey) {
        return rowKey.getId();
    }
    @Override
    public Agenda getRowData(String rowKey) {
        List<Agenda> lista = (List<Agenda>) getWrappedData();
        for (Agenda g : lista) {
            if (g.getId().equals(rowKey)) {
                return g;
            }
        }
        return null;
    }
}
